package com.yxym.interclass;

public class InnerClassExercise02 {
    public static void main(String[] args) {
        CellPhone cellPhone = new CellPhone();
        //1.传递实现Bell接口的匿名内部类InnerClassExercise02$1
        //2.重写ring方法
        cellPhone.clock(new Bell() {
            @Override
            public void ring() {
                System.out.println("起床了...");
            }
        });
//        cellPhone.clock(new Bell() {
//            @Override
//            public void ring() {
//                System.out.println("早上好...");
//            }
//        });
    }
}

interface Bell{//接口
    void ring();//方法
}

class CellPhone{//类
    public void clock(Bell bell){//形参接口类型
        bell.ring();//动态绑定
        System.out.println(bell.getClass());
    }
}
